using System.ComponentModel.DataAnnotations.Schema;
using System.Data.Entity.ModelConfiguration;

namespace ExcellOnServices.Models.Mapping
{
    public class Accounts_CompanyMap : EntityTypeConfiguration<Accounts_Company>
    {
        public Accounts_CompanyMap()
        {
            // Primary Key
            this.HasKey(t => t.Id);

            // Properties
            this.Property(t => t.BrandName)
                .IsRequired();

            this.Property(t => t.Address)
                .IsRequired();

            this.Property(t => t.Telephone)
                .IsRequired();

            this.Property(t => t.Id)
                .HasDatabaseGeneratedOption(DatabaseGeneratedOption.None);

            // Table & Column Mappings
            this.ToTable("Accounts_Company");
            this.Property(t => t.BrandName).HasColumnName("BrandName");
            this.Property(t => t.Address).HasColumnName("Address");
            this.Property(t => t.Telephone).HasColumnName("Telephone");
            this.Property(t => t.Description).HasColumnName("Description");
            this.Property(t => t.Status).HasColumnName("Status");
            this.Property(t => t.Id).HasColumnName("Id");

            // Relationships
            this.HasRequired(t => t.Account)
                .WithOptional(t => t.Accounts_Company);
        }
    }
}
